import {reqAddressInfo, reqOrderInfo} from "../../api";

export default ({
    namespaced: true,
    state: {
        address: [],
        orderInfo: {}
    },
    mutations: {
        GETUSERADDRESS(state, value) {
            state.address = value
        },
        GETORDERINFO(state, value) {
            state.orderInfo = value
        }
    },
    actions: {
        // 获取用户地址
        async getUserAddress({commit}) {
            let result = await reqAddressInfo()
            // console.log(result)
            if (result.code == 200) {
                commit('GETUSERADDRESS', result.data)
            }
        },
        // 获取商品清单
        async getOrderInfo({commit}) {
            let result = await reqOrderInfo()
            // console.log(result)
            if (result.code == 200) {
                commit('GETORDERINFO', result.data)
            }
        }
    },
    getters: {}

})